function HandleProduceLastUpdated(gui, user, date, options, data) {
  this._gui = gui;
  this._user = user;
  this._date = date;
  this._options = options;
  this._data = data;
  
  this._popupBox = new ModulePopupBox();
  
  this._createElements();
};


HandleProduceLastUpdated.prototype._createElements = function() {
  var unique = MiscUtils.unique(), _self = this, tr, td;
  DOMUtils.removeTableRows(this._gui.lastUpdates, 1);
  DOMUtils.removeChildElements(this._gui.findMore);
  
  this._models = this._data['pz_model'];
  this._states = this._data['pz_model_state'];
  this._transitions = this._data['pz_model_transition'];
  this._events = (this._data['event']) ? this._data['event'].data : [];
  
  if (this._events.length == 0) {
    tr = this._gui.lastUpdates.insertRow(-1);
    td = tr.insertCell(-1);
    td.colSpan = 10;
    td.style.height = '20px';
    td.style.textAlign = 'left';
    td.style.paddingLeft = '5px';
    td.appendChild(document.createTextNode('n/a'));
  }
  
  if (this._events.length > 20) {
    var a = document.createElement('a');
    a.href = '#';
    a.appendChild(document.createTextNode('Find All Records'));
    a.onclick = function() { var w = window.open('?t=plastupdated', 'Lastupdated', 'width=1024,height=768,scrollbars=yes,location=yes', true);
                             w.focus();
                             return false;
                           };
    this._gui.findMore.appendChild(a);
  }
  
  for (var i = 0, il = this._events.length; i < il; i++) {
    var event = this._events[i];
    if (i >= 20) {
      break;
    }
    tr = this._gui.lastUpdates.insertRow(-1);
    tr.style.backgroundColor = (tr.rowIndex % 2 == 0) ? '#f4f4f4' : '#fff';
    td = tr.insertCell(-1);
    td.style.padding = '0 10px 0 5px';
    td.style.borderRight = 'solid 1px #bbb';
    td.appendChild(document.createTextNode((event.branch) ? event.branch : '-'));
    
    td = tr.insertCell(-1);
    td.style.padding = '0 10px 0 5px';
    td.style.borderRight = 'solid 1px #bbb';
//    td.appendChild(document.createTextNode((event.customer_id != 0) ? PPublishUtils.customerId(event.customer_id) : '-'));
    td.appendChild(document.createTextNode((event.model_id != 2) ? (event.customer_id != 0) ? PPublishUtils.customerId(event.customer_id) : '-' : 'Parcel ' + event.code));

    td = tr.insertCell(-1);
    td.style.padding = '0 10px 0 5px';
    td.style.borderRight = 'solid 1px #bbb';
    td.appendChild(document.createTextNode(SimpleDate.format(SimpleDate.fromStamp(event.created_date))));
    
    td = tr.insertCell(-1);
    td.style.padding = '0 10px 0 5px';
    td.style.borderRight = 'solid 1px #bbb';
    td.appendChild(document.createTextNode((event.received_date != 0) ? SimpleDate.format(SimpleDate.fromStamp(event.received_date)) : '-'));
    
    if (event.model_id == 3) {
      td = tr.insertCell(-1);
      td.style.padding = '0 10px 0 5px';
      td.style.borderRight = 'solid 1px #bbb';
      td.colSpan = 2;
      var span = document.createElement('span');
      span.style.fontWeight = 'bold';
      span.appendChild(document.createTextNode('From: '));
      td.appendChild(span);
      td.appendChild(document.createTextNode((event.custom_assigner) ? event.custom_assigner : '-'));
    } else {
      td = tr.insertCell(-1);
      td.style.padding = '0 10px 0 5px';
      td.style.borderRight = 'solid 1px #bbb';
      td.appendChild(document.createTextNode((event.photographer) ? event.photographer : '-'));
      
      td = tr.insertCell(-1);
      td.style.padding = '0 10px 0 5px';
      td.style.borderRight = 'solid 1px #bbb';
      td.appendChild(document.createTextNode((event.photographer2) ? event.photographer2 : '-'));
    }
    
    td = tr.insertCell(-1);
    td.style.padding = '0 10px 0 5px';
    td.style.borderRight = 'solid 1px #bbb';
    if (event.model_id == 3) {
      var span = document.createElement('span');
      span.style.fontWeight = 'bold';
      span.appendChild(document.createTextNode('To: '));
      td.appendChild(span);
      td.appendChild(document.createTextNode((event.custom_assignee) ? event.custom_assignee : '-'));
    } else {
      td.appendChild(document.createTextNode((event.designer) ? event.designer : '-'));
    }
    
    td = tr.insertCell(-1);
    td.style.borderRight = 'solid 1px #bbb';
    td.style.padding = '0 10px 0 5px';
    var state = PPublishUtils.object(event.s_id, this._states);
    var transition = PPublishUtils.object(event.t_id, this._transitions);
    var str = state.name + ((transition) ? '(' + transition.name + ')' : '') + ((event.message) ? ' / ' + event.message : '') + ((event.message && event.overdue) ? ' / ' : '') + ((event.overdue) ? 'Overdue Reason: ' + event.overdue : '')
    td.appendChild(document.createTextNode(str));
    
    td = tr.insertCell(-1);
    td.style.height = '21px';
    td.style.borderRight = 'solid 1px #bbb';
    td.style.padding = '0 10px 0 5px';
    td.appendChild(document.createTextNode((event.user) ? event.user : '-'));
    
    td = tr.insertCell(-1);
    td.style.padding = '0 10px 0 5px';
    td.appendChild(document.createTextNode(SimpleDate.format(SimpleDate.fromStamp(event.date))));
  }
};